package org.yzl.designPatterns.flyweight;

/**
 * 享元模式
 */
public class FlyweightTest {
    public static void main(String[] args) {
        IgoChessman a,b,c,d,e,f;

        IgoChessmanFactory igoChessmanFactory = IgoChessmanFactory.getInstance();
        a = igoChessmanFactory.getIgoChessman("w");
        b = igoChessmanFactory.getIgoChessman("w");
        c = igoChessmanFactory.getIgoChessman("b");
        d = igoChessmanFactory.getIgoChessman("b");

        System.out.println("a==b?"+ (a==b));
        System.out.println("c==d?"+ (c==d));

        a.display(new Coordinates(1,2));
        b.display(new Coordinates(3,4));
        c.display(new Coordinates(5,6));
        d.display(new Coordinates(7,8));
    }
}
